﻿using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace com.yoozoo.gta.Extension
{
    [CustomEditor(typeof(DragScaleScrollRect))]
    public class DragScaleScrollRectEditor : UnityEditor.UI.ScrollRectEditor
    {
        SerializedProperty m_DragScaleOpen;
        SerializedProperty m_DefaultScale;
        SerializedProperty m_MinScale;
        SerializedProperty m_MaxScale;
        SerializedProperty m_ScaleSensitivity;

        protected override void OnEnable()
        {
            base.OnEnable();
            
            m_DragScaleOpen = serializedObject.FindProperty("_DragScaleOpen");
            m_DefaultScale = serializedObject.FindProperty("_DefaultScale");
            m_MinScale = serializedObject.FindProperty("_MinScale");
            m_MaxScale = serializedObject.FindProperty("_MaxScale");
            m_ScaleSensitivity = serializedObject.FindProperty("_ScaleSensitivity");
        }
        
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            EditorGUILayout.PropertyField(m_DragScaleOpen, new GUIContent("开启拖拽缩放"));
            EditorGUILayout.PropertyField(m_DefaultScale, new GUIContent("默认缩放值"));
            EditorGUILayout.PropertyField(m_MinScale, new GUIContent("最小缩放值"));
            EditorGUILayout.PropertyField(m_MaxScale, new GUIContent("最大缩放值"));
            EditorGUILayout.PropertyField(m_ScaleSensitivity, new GUIContent("缩放灵敏度"));
            serializedObject.ApplyModifiedProperties();
        }
    }
}